// Copyright 2021 ETH Zurich and University of Bologna.
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
// SPDX-License-Identifier: SHL-0.51
//
// Author: Matteo Perotti <mperotti@iis.ee.ethz.ch>
//         Basile Bougenot <bbougenot@student.ethz.ch>

#include "float_macros.h"
#include "vector_macros.h"

// Simple random test with similar values
void TEST_CASE1(void) {
  VSET(16, e16, m1);
  //              -0.0371,  0.8374,  0.7183,  0.8086, -0.8940,  0.4626,  0.5449,
  //              0.6831,  0.4661,  0.2981,  0.5615, -0.6167, -0.7075, -0.7603,
  //              0.8438, -0.2742
  VLOAD_16(v2, 0xa8c1, 0x3ab3, 0x39bf, 0x3a78, 0xbb27, 0x3767, 0x385c, 0x3977,
           0x3775, 0x34c5, 0x387e, 0xb8ef, 0xb9a9, 0xba15, 0x3ac0, 0xb463);
  //               0.3516,  0.7925, -0.5034, -0.1672,  0.0703, -0.9731,  0.0361,
  //               -0.4077,  0.8965,  0.8242, -0.7822,  0.0265, -0.5361, 0.1226,
  //               -0.9917,  0.5415
  VLOAD_16(v3, 0x35a0, 0x3a57, 0xb807, 0xb15a, 0x2c7f, 0xbbc9, 0x289f, 0xb686,
           0x3b2c, 0x3a98, 0xba42, 0x26cb, 0xb84a, 0x2fd8, 0xbbef, 0x3855);
  asm volatile("vfsgnjx.vv v1, v2, v3");
  //              -0.0371,  0.8374, -0.7183, -0.8086, -0.8940, -0.4626,  0.5449,
  //              -0.6831,  0.4661,  0.2981, -0.5615, -0.6167,  0.7075, -0.7603,
  //              -0.8438, -0.2742
  VCMP_U16(1, v1, 0xa8c1, 0x3ab3, 0xb9bf, 0xba78, 0xbb27, 0xb767, 0x385c,
           0xb977, 0x3775, 0x34c5, 0xb87e, 0xb8ef, 0x39a9, 0xba15, 0xbac0,
           0xb463);

  VSET(16, e32, m1);
  //              -0.00918692, -0.23372029,  0.42919466,  0.95128548,
  //              0.05014091,  0.08194520,  0.65458435,  0.38167605,
  //              -0.52784044,  0.46330592,  0.66792834,  0.94584799,
  //              -0.11679628,  0.12139154,  0.61421394, -0.71422517
  VLOAD_32(v2, 0xbc1684ba, 0xbe6f545f, 0x3edbbf67, 0x3f738772, 0x3d4d608d,
           0x3da7d2e2, 0x3f2792d7, 0x3ec36b0b, 0xbf07208d, 0x3eed366f,
           0x3f2afd5a, 0x3f722318, 0xbdef32e4, 0x3df89c21, 0x3f1d3d20,
           0xbf36d776);
  //              -0.96525091, -0.82903022, -0.98528612,  0.36915505,
  //              0.23285799,  0.19133335,  0.78484982, -0.40654737,
  //              -0.40144378, -0.94419461,  0.60990387, -0.37662670,
  //              0.75369638, -0.82297397,  0.24545205, -0.75572032
  VLOAD_32(v3, 0xbf771aaf, 0xbf543b53, 0xbf7c3bb6, 0x3ebd01e4, 0x3e6e7253,
           0x3e43ece4, 0x3f48ebeb, 0xbed026fa, 0xbecd8a0a, 0xbf71b6bd,
           0x3f1c22a9, 0xbec0d537, 0x3f40f23f, 0xbf52ae6c, 0x3e7b57c8,
           0xbf4176e3);
  asm volatile("vfsgnjx.vv v1, v2, v3");
  //               0.00918692,  0.23372029, -0.42919466,  0.95128548,
  //               0.05014091,  0.08194520,  0.65458435, -0.38167605,
  //               0.52784044, -0.46330592,  0.66792834, -0.94584799,
  //               -0.11679628, -0.12139154,  0.61421394,  0.71422517
  VCMP_U32(2, v1, 0x3c1684ba, 0x3e6f545f, 0xbedbbf67, 0x3f738772, 0x3d4d608d,
           0x3da7d2e2, 0x3f2792d7, 0xbec36b0b, 0x3f07208d, 0xbeed366f,
           0x3f2afd5a, 0xbf722318, 0xbdef32e4, 0xbdf89c21, 0x3f1d3d20,
           0x3f36d776);

  VSET(16, e64, m1);
  //              -0.4085246287477386,  0.8681744372264055, -0.9782992825101422,
  //              0.9959576051606904, -0.7910104167136705,  0.0799315061445605,
  //              0.2562329212571202, -0.0401280831920132, -0.6164331117742006,
  //              0.0314794700215042, -0.2391312835511448,  0.2944948324466776,
  //              -0.3469257666022745,  0.3129356083924371,  0.1418123916338592,
  //              -0.2697778839142546
  VLOAD_64(v2, 0xbfda25447c0540c8, 0x3febc815c1e38a2c, 0xbfef4e3a4c029a38,
           0x3fefdee27bcbc3c2, 0xbfe94ff513d293d6, 0x3fb4766424cf97d0,
           0x3fd0661ec43d4dd0, 0xbfa48bab09ebf660, 0xbfe3b9d1eee7bc0a,
           0x3fa01e13bc79bd60, 0xbfce9bda9926bde0, 0x3fd2d900da8cc448,
           0xbfd63408216c936c, 0x3fd4072312f3290c, 0x3fc226e8901e1378,
           0xbfd1440a752621b8);
  //              -0.9042358342806300,  0.2953863994960662, -0.4373909703642964,
  //              0.1464626280814265, -0.5161207396769107, -0.3525096032632213,
  //              -0.0692332757289065, -0.9900711773455610,  0.6225050177521096,
  //              -0.1361158534833962,  0.1558021548512183,  0.9766583762298613,
  //              0.2768845956890595,  0.6672273199701737, -0.4444943981200347,
  //              0.5095574851608440
  VLOAD_64(v3, 0xbfecef7ffd03691e, 0x3fd2e79c5b6133f0, 0xbfdbfe36b251f164,
           0x3fc2bf4992d91480, 0xbfe0840fa43663a0, 0xbfd68f847062a774,
           0xbfb1b9459f0cf460, 0xbfefaea9bfed2a32, 0x3fe3eb8fa49aeb32,
           0xbfc16c3e8996d300, 0x3fc3f15333ddbc58, 0x3fef40c91128b1ea,
           0x3fd1b87a2ad00b5c, 0x3fe559ed1bc8a0c2, 0xbfdc7298a1cb9174,
           0x3fe04e4b7fc654a0);
  asm volatile("vfsgnjx.vv v1, v2, v3");
  //               0.4085246287477386,  0.8681744372264055,  0.9782992825101422,
  //               0.9959576051606904,  0.7910104167136705, -0.0799315061445605,
  //               -0.2562329212571202,  0.0401280831920132,
  //               -0.6164331117742006, -0.0314794700215042,
  //               -0.2391312835511448,  0.2944948324466776,
  //               -0.3469257666022745,  0.3129356083924371,
  //               -0.1418123916338592, -0.2697778839142546
  VCMP_U64(3, v1, 0x3fda25447c0540c8, 0x3febc815c1e38a2c, 0x3fef4e3a4c029a38,
           0x3fefdee27bcbc3c2, 0x3fe94ff513d293d6, 0xbfb4766424cf97d0,
           0xbfd0661ec43d4dd0, 0x3fa48bab09ebf660, 0xbfe3b9d1eee7bc0a,
           0xbfa01e13bc79bd60, 0xbfce9bda9926bde0, 0x3fd2d900da8cc448,
           0xbfd63408216c936c, 0x3fd4072312f3290c, 0xbfc226e8901e1378,
           0xbfd1440a752621b8);
};

// Simple random test with similar values (masked)
// The numbers are the same of TEST_CASE1
void TEST_CASE2(void) {
  VSET(16, e16, m1);
  //              -0.0371,  0.8374,  0.7183,  0.8086, -0.8940,  0.4626,  0.5449,
  //              0.6831,  0.4661,  0.2981,  0.5615, -0.6167, -0.7075, -0.7603,
  //              0.8438, -0.2742
  VLOAD_16(v2, 0xa8c1, 0x3ab3, 0x39bf, 0x3a78, 0xbb27, 0x3767, 0x385c, 0x3977,
           0x3775, 0x34c5, 0x387e, 0xb8ef, 0xb9a9, 0xba15, 0x3ac0, 0xb463);
  //               0.3516,  0.7925, -0.5034, -0.1672,  0.0703, -0.9731,  0.0361,
  //               -0.4077,  0.8965,  0.8242, -0.7822,  0.0265, -0.5361, 0.1226,
  //               -0.9917,  0.5415
  VLOAD_16(v3, 0x35a0, 0x3a57, 0xb807, 0xb15a, 0x2c7f, 0xbbc9, 0x289f, 0xb686,
           0x3b2c, 0x3a98, 0xba42, 0x26cb, 0xb84a, 0x2fd8, 0xbbef, 0x3855);
  VLOAD_8(v0, 0xAA, 0xAA);
  VCLEAR(v1);
  asm volatile("vfsgnjx.vv v1, v2, v3, v0.t");
  //               0.0000,  0.8374,  0.0000, -0.8086,  0.0000, -0.4626,  0.0000,
  //               -0.6831,  0.0000,  0.2981,  0.0000, -0.6167,  0.0000,
  //               -0.7603,  0.0000, -0.2742
  VCMP_U16(4, v1, 0x0, 0x3ab3, 0x0, 0xba78, 0x0, 0xb767, 0x0, 0xb977, 0x0,
           0x34c5, 0x0, 0xb8ef, 0x0, 0xba15, 0x0, 0xb463);

  VSET(16, e32, m1);
  //              -0.00918692, -0.23372029,  0.42919466,  0.95128548,
  //              0.05014091,  0.08194520,  0.65458435,  0.38167605,
  //              -0.52784044,  0.46330592,  0.66792834,  0.94584799,
  //              -0.11679628,  0.12139154,  0.61421394, -0.71422517
  VLOAD_32(v2, 0xbc1684ba, 0xbe6f545f, 0x3edbbf67, 0x3f738772, 0x3d4d608d,
           0x3da7d2e2, 0x3f2792d7, 0x3ec36b0b, 0xbf07208d, 0x3eed366f,
           0x3f2afd5a, 0x3f722318, 0xbdef32e4, 0x3df89c21, 0x3f1d3d20,
           0xbf36d776);
  //              -0.96525091, -0.82903022, -0.98528612,  0.36915505,
  //              0.23285799,  0.19133335,  0.78484982, -0.40654737,
  //              -0.40144378, -0.94419461,  0.60990387, -0.37662670,
  //              0.75369638, -0.82297397,  0.24545205, -0.75572032
  VLOAD_32(v3, 0xbf771aaf, 0xbf543b53, 0xbf7c3bb6, 0x3ebd01e4, 0x3e6e7253,
           0x3e43ece4, 0x3f48ebeb, 0xbed026fa, 0xbecd8a0a, 0xbf71b6bd,
           0x3f1c22a9, 0xbec0d537, 0x3f40f23f, 0xbf52ae6c, 0x3e7b57c8,
           0xbf4176e3);
  VLOAD_8(v0, 0xAA, 0xAA);
  VCLEAR(v1);
  asm volatile("vfsgnjx.vv v1, v2, v3, v0.t");
  //               0.00000000,  0.23372029,  0.00000000,  0.95128548,
  //               0.00000000,  0.08194520,  0.00000000, -0.38167605,
  //               0.00000000, -0.46330592,  0.00000000, -0.94584799,
  //               0.00000000, -0.12139154,  0.00000000,  0.71422517
  VCMP_U32(5, v1, 0x0, 0x3e6f545f, 0x0, 0x3f738772, 0x0, 0x3da7d2e2, 0x0,
           0xbec36b0b, 0x0, 0xbeed366f, 0x0, 0xbf722318, 0x0, 0xbdf89c21, 0x0,
           0x3f36d776);

  VSET(16, e64, m1);
  //              -0.4085246287477386,  0.8681744372264055, -0.9782992825101422,
  //              0.9959576051606904, -0.7910104167136705,  0.0799315061445605,
  //              0.2562329212571202, -0.0401280831920132, -0.6164331117742006,
  //              0.0314794700215042, -0.2391312835511448,  0.2944948324466776,
  //              -0.3469257666022745,  0.3129356083924371,  0.1418123916338592,
  //              -0.2697778839142546
  VLOAD_64(v2, 0xbfda25447c0540c8, 0x3febc815c1e38a2c, 0xbfef4e3a4c029a38,
           0x3fefdee27bcbc3c2, 0xbfe94ff513d293d6, 0x3fb4766424cf97d0,
           0x3fd0661ec43d4dd0, 0xbfa48bab09ebf660, 0xbfe3b9d1eee7bc0a,
           0x3fa01e13bc79bd60, 0xbfce9bda9926bde0, 0x3fd2d900da8cc448,
           0xbfd63408216c936c, 0x3fd4072312f3290c, 0x3fc226e8901e1378,
           0xbfd1440a752621b8);
  //              -0.9042358342806300,  0.2953863994960662, -0.4373909703642964,
  //              0.1464626280814265, -0.5161207396769107, -0.3525096032632213,
  //              -0.0692332757289065, -0.9900711773455610,  0.6225050177521096,
  //              -0.1361158534833962,  0.1558021548512183,  0.9766583762298613,
  //              0.2768845956890595,  0.6672273199701737, -0.4444943981200347,
  //              0.5095574851608440
  VLOAD_64(v3, 0xbfecef7ffd03691e, 0x3fd2e79c5b6133f0, 0xbfdbfe36b251f164,
           0x3fc2bf4992d91480, 0xbfe0840fa43663a0, 0xbfd68f847062a774,
           0xbfb1b9459f0cf460, 0xbfefaea9bfed2a32, 0x3fe3eb8fa49aeb32,
           0xbfc16c3e8996d300, 0x3fc3f15333ddbc58, 0x3fef40c91128b1ea,
           0x3fd1b87a2ad00b5c, 0x3fe559ed1bc8a0c2, 0xbfdc7298a1cb9174,
           0x3fe04e4b7fc654a0);
  VLOAD_8(v0, 0xAA, 0xAA);
  VCLEAR(v1);
  asm volatile("vfsgnjx.vv v1, v2, v3, v0.t");
  //               0.0000000000000000,  0.8681744372264055,  0.0000000000000000,
  //               0.9959576051606904,  0.0000000000000000, -0.0799315061445605,
  //               0.0000000000000000,  0.0401280831920132,  0.0000000000000000,
  //               -0.0314794700215042,  0.0000000000000000, 0.2944948324466776,
  //               0.0000000000000000,  0.3129356083924371,  0.0000000000000000,
  //               -0.2697778839142546
  VCMP_U64(6, v1, 0x0, 0x3febc815c1e38a2c, 0x0, 0x3fefdee27bcbc3c2, 0x0,
           0xbfb4766424cf97d0, 0x0, 0x3fa48bab09ebf660, 0x0, 0xbfa01e13bc79bd60,
           0x0, 0x3fd2d900da8cc448, 0x0, 0x3fd4072312f3290c, 0x0,
           0xbfd1440a752621b8);
};

// Simple random test with similar values (vector-scalar)
void TEST_CASE3(void) {
  VSET(16, e16, m1);
  double dscalar_16;
  //                             -0.9766
  BOX_HALF_IN_DOUBLE(dscalar_16, 0xbbd0);
  //               0.8535, -0.3750, -0.8066, -0.9097, -0.2216, -0.5645, -0.3149,
  //               -0.4512,  0.5981,  0.6587,  0.9546, -0.3040, -0.6157, 0.5723,
  //               0.8438, -0.1544
  VLOAD_16(v2, 0x3ad4, 0xb600, 0xba74, 0xbb47, 0xb317, 0xb884, 0xb50a, 0xb738,
           0x38c9, 0x3945, 0x3ba3, 0xb4dd, 0xb8ed, 0x3894, 0x3ac0, 0xb0f1);
  asm volatile("vfsgnjx.vf v1, v2, %[A]" ::[A] "f"(dscalar_16));
  //              -0.8535,  0.3750,  0.8066,  0.9097,  0.2216,  0.5645,  0.3149,
  //              0.4512, -0.5981, -0.6587, -0.9546,  0.3040,  0.6157, -0.5723,
  //              -0.8438,  0.1544
  VCMP_U16(7, v1, 0xbad4, 0x3600, 0x3a74, 0x3b47, 0x3317, 0x3884, 0x350a,
           0x3738, 0xb8c9, 0xb945, 0xbba3, 0x34dd, 0x38ed, 0xb894, 0xbac0,
           0x30f1);

  VSET(16, e32, m1);
  double dscalar_32;
  //                              -0.71056527
  BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf35e79b);
  //              -0.13350210, -0.18642496,  0.30152589, -0.62076813,
  //              0.00040700, -0.59566921, -0.88075870,  0.08096603, 0.94059193,
  //              -0.29601631, -0.54263371, -0.86016685, -0.57158113,
  //              0.85538357, -0.76839548,  0.28374606
  VLOAD_32(v2, 0xbe08b4c6, 0xbe3ee62f, 0x3e9a619a, 0xbf1eeaa9, 0x39d561f4,
           0xbf187dc7, 0xbf617967, 0x3da5d185, 0x3f70caa2, 0xbe978f73,
           0xbf0aea0b, 0xbf5c33e5, 0xbf125324, 0x3f5afa6b, 0xbf44b591,
           0x3e91472a);
  asm volatile("vfsgnjx.vf v1, v2, %[A]" ::[A] "f"(dscalar_32));
  //               0.13350210,  0.18642496, -0.30152589,  0.62076813,
  //               -0.00040700,  0.59566921,  0.88075870, -0.08096603,
  //               -0.94059193,  0.29601631,  0.54263371,  0.86016685,
  //               0.57158113, -0.85538357,  0.76839548, -0.28374606
  VCMP_U32(8, v1, 0x3e08b4c6, 0x3e3ee62f, 0xbe9a619a, 0x3f1eeaa9, 0xb9d561f4,
           0x3f187dc7, 0x3f617967, 0xbda5d185, 0xbf70caa2, 0x3e978f73,
           0x3f0aea0b, 0x3f5c33e5, 0x3f125324, 0xbf5afa6b, 0x3f44b591,
           0xbe91472a);

  VSET(16, e64, m1);
  double dscalar_64;
  //                               -0.1599292306617626
  BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfc4788f9faef060);
  //               -0.3770377828689853,  0.5963307040587882,
  //               -0.4228346580189990, -0.8395360297727528, 0.2884308755790033,
  //               -0.9332093226534830, -0.3077793113682024,
  //               -0.3241690978469995,  0.9848431705043186, 0.5835571766262024,
  //               0.6934128987139432, -0.8499240402166686,  0.9392758702585176,
  //               0.8754505566292561, -0.4187493105472220, -0.7967172481248119
  VLOAD_64(v2, 0xbfd8216314b1d540, 0x3fe3152420f10f90, 0xbfdb0fb918f3a4fc,
           0xbfeadd7aa9f60146, 0x3fd275a6c6712e84, 0xbfeddcd9cc23cf06,
           0xbfd3b2a7ff2d8ea0, 0xbfd4bf2fbe681ba4, 0x3fef83d5d32028f6,
           0x3fe2ac80199e9490, 0x3fe630703f533af4, 0xbfeb3293e69a12ae,
           0x3fee0e8c4515d52c, 0x3fec03b0e2bf9ad6, 0xbfdaccc9e88176a4,
           0xbfe97eb52b9b5dac);
  asm volatile("vfsgnjx.vf v1, v2, %[A]" ::[A] "f"(dscalar_64));
  //               0.3770377828689853, -0.5963307040587882,  0.4228346580189990,
  //               0.8395360297727528, -0.2884308755790033,  0.9332093226534830,
  //               0.3077793113682024,  0.3241690978469995, -0.9848431705043186,
  //               -0.5835571766262024, -0.6934128987139432, 0.8499240402166686,
  //               -0.9392758702585176, -0.8754505566292561, 0.4187493105472220,
  //               0.7967172481248119
  VCMP_U64(9, v1, 0x3fd8216314b1d540, 0xbfe3152420f10f90, 0x3fdb0fb918f3a4fc,
           0x3feadd7aa9f60146, 0xbfd275a6c6712e84, 0x3feddcd9cc23cf06,
           0x3fd3b2a7ff2d8ea0, 0x3fd4bf2fbe681ba4, 0xbfef83d5d32028f6,
           0xbfe2ac80199e9490, 0xbfe630703f533af4, 0x3feb3293e69a12ae,
           0xbfee0e8c4515d52c, 0xbfec03b0e2bf9ad6, 0x3fdaccc9e88176a4,
           0x3fe97eb52b9b5dac);
};

// Simple random test with similar values (vector-scalar) (masked)
void TEST_CASE4(void) {
  VSET(16, e16, m1);
  double dscalar_16;
  //                             -0.9766
  BOX_HALF_IN_DOUBLE(dscalar_16, 0xbbd0);
  //                0.8535, -0.3750, -0.8066, -0.9097, -0.2216, -0.5645,
  //                -0.3149, -0.4512,  0.5981,  0.6587,  0.9546, -0.3040,
  //                -0.6157,  0.5723,  0.8438, -0.1544
  VLOAD_16(v2, 0x3ad4, 0xb600, 0xba74, 0xbb47, 0xb317, 0xb884, 0xb50a, 0xb738,
           0x38c9, 0x3945, 0x3ba3, 0xb4dd, 0xb8ed, 0x3894, 0x3ac0, 0xb0f1);
  VLOAD_8(v0, 0xAA, 0xAA);
  VCLEAR(v1);
  asm volatile("vfsgnjx.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_16));
  //                0.0000,  0.3750,  0.0000,  0.9097,  0.0000,  0.5645, 0.0000,
  //                0.4512,  0.0000, -0.6587,  0.0000,  0.3040,  0.0000,
  //                -0.5723,  0.0000,  0.1544
  VCMP_U16(10, v1, 0x0, 0x3600, 0x0, 0x3b47, 0x0, 0x3884, 0x0, 0x3738, 0x0,
           0xb945, 0x0, 0x34dd, 0x0, 0xb894, 0x0, 0x30f1);

  VSET(16, e32, m1);
  double dscalar_32;
  //                              -0.71056527
  BOX_FLOAT_IN_DOUBLE(dscalar_32, 0xbf35e79b);
  //               -0.13350210, -0.18642496,  0.30152589, -0.62076813,
  //               0.00040700, -0.59566921, -0.88075870,  0.08096603,
  //               0.94059193, -0.29601631, -0.54263371, -0.86016685,
  //               -0.57158113,  0.85538357, -0.76839548,  0.28374606
  VLOAD_32(v2, 0xbe08b4c6, 0xbe3ee62f, 0x3e9a619a, 0xbf1eeaa9, 0x39d561f4,
           0xbf187dc7, 0xbf617967, 0x3da5d185, 0x3f70caa2, 0xbe978f73,
           0xbf0aea0b, 0xbf5c33e5, 0xbf125324, 0x3f5afa6b, 0xbf44b591,
           0x3e91472a);
  VLOAD_8(v0, 0xAA, 0xAA);
  VCLEAR(v1);
  asm volatile("vfsgnjx.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_32));
  //                0.00000000,  0.18642496,  0.00000000,  0.62076813,
  //                0.00000000,  0.59566921,  0.00000000, -0.08096603,
  //                0.00000000,  0.29601631,  0.00000000,  0.86016685,
  //                0.00000000, -0.85538357,  0.00000000, -0.28374606
  VCMP_U32(11, v1, 0x0, 0x3e3ee62f, 0x0, 0x3f1eeaa9, 0x0, 0x3f187dc7, 0x0,
           0xbda5d185, 0x0, 0x3e978f73, 0x0, 0x3f5c33e5, 0x0, 0xbf5afa6b, 0x0,
           0xbe91472a);

  VSET(16, e64, m1);
  double dscalar_64;
  //                               -0.1599292306617626
  BOX_DOUBLE_IN_DOUBLE(dscalar_64, 0xbfc4788f9faef060);
  //                -0.3770377828689853,  0.5963307040587882,
  //                -0.4228346580189990, -0.8395360297727528,
  //                0.2884308755790033, -0.9332093226534830,
  //                -0.3077793113682024, -0.3241690978469995,
  //                0.9848431705043186,  0.5835571766262024, 0.6934128987139432,
  //                -0.8499240402166686,  0.9392758702585176,
  //                0.8754505566292561, -0.4187493105472220, -0.7967172481248119
  VLOAD_64(v2, 0xbfd8216314b1d540, 0x3fe3152420f10f90, 0xbfdb0fb918f3a4fc,
           0xbfeadd7aa9f60146, 0x3fd275a6c6712e84, 0xbfeddcd9cc23cf06,
           0xbfd3b2a7ff2d8ea0, 0xbfd4bf2fbe681ba4, 0x3fef83d5d32028f6,
           0x3fe2ac80199e9490, 0x3fe630703f533af4, 0xbfeb3293e69a12ae,
           0x3fee0e8c4515d52c, 0x3fec03b0e2bf9ad6, 0xbfdaccc9e88176a4,
           0xbfe97eb52b9b5dac);
  VLOAD_8(v0, 0xAA, 0xAA);
  VCLEAR(v1);
  asm volatile("vfsgnjx.vf v1, v2, %[A], v0.t" ::[A] "f"(dscalar_64));
  //                0.0000000000000000, -0.5963307040587882, 0.0000000000000000,
  //                0.8395360297727528,  0.0000000000000000, 0.9332093226534830,
  //                0.0000000000000000,  0.3241690978469995, 0.0000000000000000,
  //                -0.5835571766262024,  0.0000000000000000,
  //                0.8499240402166686,  0.0000000000000000,
  //                -0.8754505566292561,  0.0000000000000000, 0.7967172481248119
  VCMP_U64(12, v1, 0x0, 0xbfe3152420f10f90, 0x0, 0x3feadd7aa9f60146, 0x0,
           0x3feddcd9cc23cf06, 0x0, 0x3fd4bf2fbe681ba4, 0x0, 0xbfe2ac80199e9490,
           0x0, 0x3feb3293e69a12ae, 0x0, 0xbfec03b0e2bf9ad6, 0x0,
           0x3fe97eb52b9b5dac);
};

int main(void) {
  enable_vec();
  enable_fp();

  TEST_CASE1();
  TEST_CASE2();
  TEST_CASE3();
  TEST_CASE4();

  EXIT_CHECK();
}
